package com.mxsat.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.mxsat.system.entity.SysUser;
import com.mxsat.system.service.SysUserService;

@RestController
@RequestMapping("/Login/")
public class LoginController {

	@Autowired
	private SysUserService sysUserService;

	@Deprecated
	@GetMapping("/DoGet/{name}/{pwd}")
	public SysUser doGetLogin(@PathVariable String name, @PathVariable String pwd) throws Exception {
		return sysUserService.findUserForLoginByName(name, pwd);
	}
	
	@PostMapping("/Do")
	public SysUser doLogin(@RequestParam String name, @RequestParam String pwd) throws Exception {
//		String name = request.getParameter("name");
//		String pwd = request.getParameter("pwd");
		return sysUserService.findUserForLoginByName(name, pwd);
	}
	
}
